﻿
namespace vcity.Models
{
    using System.Web.Profile;
    using System.Web.Security;
    using System.ComponentModel.DataAnnotations;
    using System;

    /// <summary>
    /// Class to store application-specific user Profile information.
    /// </summary>
    public class UserProfile : ProfileBase
    {
        [Required]
        [SettingsAllowAnonymous(false)]
        public string Region
        {
            get { return base["Country"] as string; }
            set { base["Country"] = value; }
        }


        [Required]
        [SettingsAllowAnonymous(false)]
        public bool Gender
        {
            get { return (bool)base["Gender"]; }
            set { base["Gender"] = value; }
        }


        [DataType( System.ComponentModel.DataAnnotations.DataType.Date)]
        [SettingsAllowAnonymous(false)]
        public DateTime BirthDate
        {
            get { return (DateTime)base["BirthDate"]; }
            set { base["BirthDate"] = value; }
        }


        [SettingsAllowAnonymous(false)]
        public int Rate1
        {
            get { return (int)base["Rate1"]; }
            set { base["Rate1"] = value; }
        }


        [SettingsAllowAnonymous(false)]
        public int Rate2
        {
            get { return (int)base["Rate2"]; }
            set { base["Rate2"] = value; }
        }


        [Required]
        [SettingsAllowAnonymous(false)]
        public int RegionId
        {
            get { return (int)base["RegionId"]; }
            set { base["RegionId"] = value; }
        }

        
        [SettingsAllowAnonymous(false)]
        public string Photo
        {
            get { return (string)base["Photo"]; }
            set { base["Photo"] = value; }
        }


        [Required]
        [SettingsAllowAnonymous(false)]
        public string Phone
        {
            get { return (string)base["Phone"]; }
            set { base["Phone"] = value; }
        }


        public static UserProfile GetUserProfile(string userName)
        {
            return Create(userName) as UserProfile;
        }

        
        public static UserProfile GetUserProfile()
        {
            return Create(Membership.GetUser().UserName) as UserProfile;
        }
    }
}